import request from '@/utils/request'

// 登陆后切换ab角
export const chooseAbRoleAfterLogin = (data) => {
  return request({
    url: '/rm2/userMaint/chooseAbRoleAfterLogin',
    method: 'POST',
    data,
  })
}

// 登陆后选择部门
export const chooseDeptAfterLogin = (data) => {
  return request({
    url: '/rm2/userMaint/chooseDeptAfterLogin',
    method: 'POST',
    data,
  })
}

//查询用户的岗位列表,包含部门信息.
export const queryUserPostsWithDept = (data) => {
  return request({
    url: '/rm2/userMaint/queryUserPostsWithDept',
    method: 'POST',
    data,
  })
}

export const getUserPostDeptsApi = (data) => {
  return request({
    url: `/rm2/userApi/getUserPostDepts?loginName=${data.loginName}`,
    method: 'POST',
    data,
  })
}

// token剩余时间
export const residueTokenSeconds = (data) => {
  return request({
    url: `/rm2/userApi/residueTokenSeconds?token=${data.token}`,
    method: 'POST',
    noLoading: true
  })
}

//收藏
export const apiPageInsertBatch = (data) => {
  return request({
    url: '/rm2/pageFavor/insertBatch',
    method: 'POST',
    data,
  })
}
// 
export const getTmplByLoginName = (data) => {
  return request({
    url: `/gm/GMOPTmpl/getTmplByLoginName`,
    method: 'POST',
    data,
    noLoading: true
  })
}
/**
 * 查询用户首页模版
 * @param data 
 */
export const queryGMOPComp = (data) => {
  return request({
    url: `/gm/GMOPComp/queryComp`,
    method: 'POST',
    data,
    noLoading: true
  })
}
/**
 * 查询用户首页模版
 * @param data 
 */
export const getHomeTmplConfig = (data) => {
  return request({
    url: `/rm2/indexTmplConfig/get`,
    method: 'POST',
    data,
    noLoading: true
  })
}
/**
 * 新增用户的首页模版.如果已存在会覆盖旧的
 * @param data 
 * configValue: 配置值
 */
export const saveHomeTmplConfig = (data) => {
  return request({
    url: `/rm2/indexTmplConfig/insert`,
    method: 'POST',
    data,
    noLoading: true
  })
}